home *** CD-ROM | disk | FTP | other *** search
- /* MakeFTPScript v1.7 by Grzegorz Fitrzyk SP9WUN (domagal@uci.agh.edu.pl)
-
- usage: rx rexx:MakeFTPScript.rexx ADDRESS/K SOURCE/K DEST/K README/S
- ex.: rx rexx:MakeFTPScript.rexx ftp.wustl.edu ram:recent ram:script readme
-
- */
-
- parse arg ADDRESS source destin readflag
- parse var readflag ' ' readfl
-
- MODE=''
- total=0
- header='#MKFTP1'
-
- readfl=upper(readfl)
- destindx=destin||'.idx'
- options results
-
- if Open(loadit, source, 'Read') then do /* Open source file.*/
- if Open(Saveit, destin, 'Write') then do /* Open destination file. */
- call writeln(Saveit,header)
- do forever
- line=Readln(loadit)
- if eof(loadit)~=0 then leave
- if line="" then line="|"
- parse var line '|'. header
- if header="" then do
- if line~="|" then do
- call makeline
- end
- end
- end
- end; else call error_write
- end; else call error_read
-
- say 'Total size of requested files 'total'KB'
- say 'Conversion succesfull.'
-
- quitit:
- call close(saveit)
- call close(loadit)
- address command 'c:filenote 'destin' 'total'KB'
- exit
-
- error_read:
- say 'Cant find source file: 'source
- call quitit
-
- error_write:
- say 'Cant write destination file 'dest
- call quitit
-
- makeline:
- parse var line filename direct size rest
- tt2=pos('+',size)
- size2=size
- if tt2~=0 then parse var size2 size '+'
- exten=right(size,1)
- if exten='?' then size='0K'
- temp=length(size)
- size=left(size,temp-1)
- size=translate(size,,' ')
- if exten="M" then size=size*1024
- total=total+size
- linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||filename||' #'||size
- call writeln(saveit,linecom)
- if readfl="README" then call doreadme
- return
-
- doreadme:
- dlug=length(filename)
- readname=left(filename,dlug-3)
- linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||readname||'readme'||' #0'
- call writeln(saveit,linecom)
- size=0
- filename=readname||'readme'
- return
-